package test.singleton;

import dk.au.cs.peterbn.annotations.Member;
import dk.au.cs.peterbn.annotations.Pattern;

/**
 * Created by IntelliJ IDEA.
 * User: peter
 * Date: 10/28/11
 * Time: 10:52 AM
 * To change this template use File | Settings | File Templates.
 */
@Pattern(id = "test.singleton", name = "gof:Singleton", role = "Singleton")
public class Singleton {

    private Singleton() {

    }

    private static Singleton instance;

    @Member(id = "test.singleton", role = "Instance")
    public static Singleton getInstance() {
        if (instance == null) {
            instance = new Singleton();
        }
        return instance;
    }

    @Member(id = "test.singleton", role = "SingletonOperation")
    public String getPaula() {
        return "brilliant";
    }

}
